
public class Pcb 
{
	/**
	 * the process id.
	 */
	int my_pid;
	
	/**
	 * step count that CPU had gotten to when time process was preempted.
	 */
	private int my_next_step; 
	
	/**
	 * 0 = running, 1 = ready, 2 = Blocked.
	 */
	protected int my_state;
	
	/**
	 * process
	 */
	protected Process my_proc; 
	
	
	/**
	 * which mutex lock does it own.
	 */
	private int my_owns;
	
	/**
	 * the priority of the pcb
	 */
	protected int my_priority;
	
	/**
	 * lottery integer representing the pick
	 */
	protected int my_lottery;
	 
	
	public Pcb(int the_pid, int the_next_step, int the_state, Process the_proc, int the_owns)
	{
		my_pid = the_pid;
		my_next_step = the_next_step;
		my_state = the_state;
		my_proc = the_proc;
		my_owns = the_owns;
		my_priority = 10; //10 lowest priority
		my_lottery = 0;
		
	}
	
	public void setPC(final int the_PC)
	{
		my_next_step = the_PC;
	}
	
	public void setState(int the_state)
	{
		my_state = the_state;
	}
	protected int getPC() 
	{
		return my_next_step;
	}
	protected Process getProcess() 
	{
		return my_proc;
	} 
	protected int getMutex() 
	{
		return my_owns;
	}
	protected int getState() 
	{
		return my_state;
	}
	protected int getID() {
		return my_pid;
	}
	
	protected void setPriority(int the_priority)
	{
		my_priority = the_priority;
	}
	
	/** 0 = running, 1 = ready, 2 = blocked.*/
	public String stateString() {
		String str = "";
		
		if(my_state == 0) {
			str = "RUNNING";
		} else if(my_state == 1) {
			str = "READY";
		} else if(my_state == 2) {
			str = "BLOCKED";
		}  else {
			str = "IDLE";
		}
		return str;
		
	}
	
	

}
